package old_go_learn

import (
	"encoding/json"
	"fmt"
)

type IT struct {
	Company  string   `json:"company"`
	Subjects []string `json:"-"`
	IsOk     bool     `json:",string"`
	Price    float64  `json:",string"`
}

func main() {
	jsonBuf := `{"company":"name","IsOk":"true","Price":"66.66","subjects":["go","c++"]}`

	var tmp IT //定义一个结构体变量

	err := json.Unmarshal([]byte(jsonBuf), &tmp)

	if err != nil {
		fmt.Println("err = ", err)
		return
	}
	fmt.Println("tmp = ",tmp)
	fmt.Printf("tmp = %+v\n", tmp)

}
